import http from "@/utils/request";

interface PageParam {
  pageNum: number;
  pageSize: number;
  companyName?: string;
}

export function findByPage(pageParam: PageParam){
    return http.request({
        url:"/glacier-hardware/meter/findByPage",
        method:'get',
        params: {
            pageNum: pageParam.pageNum,
            pageSize: pageParam.pageSize,
            companyName: pageParam.companyName || ''
        }
    })
}

export function getWareHouse(id:any){
    return http.request({
        url:`/glacier-hardware/meter/getWareHouse?id=${id}`,
        method:'get'
    })
}

export function getHost(id:any){
    return http.request({
        url:`/glacier-hardware/meter/getHost?id=${id}`,
        method:'get'
    })
}

export function getCompany(){
    return http.request({
        url:"/glacier-hardware/meter/getCompany",
        method:'get'
    })
}

export function deleteMeter(id:any){
    return http.request({
        url:`/glacier-hardware/meter/delete?id=${id}`,
        method:'get',
    })
}

export function addMeter(data:any){
    return http.request({
        url:`/glacier-hardware/meter/add`,
        method:'post',
        data
    })
}

export function getMeter(id:any){
    return http.request({
        url:`/glacier-hardware/meter/findById?id=${id}`,
        method:'get',
    })
}

export function updateMeter(data:any){
    return http.request({
        url:`/glacier-hardware/meter/update`,
        method:'post',
        data
    })
}

export function getMeterExcel(){
    return http.request({
        url:`/glacier-hardware/meter/getMeterExcel`,
        method:'get',
        responseType: 'blob'// 告知axios期望返回的数据类型为二进制流
    })
}